package com.ruoyi.thgd.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.thgd.domain.ThgdLdcJcsjDdl;
import com.ruoyi.thgd.service.IThgdLdcJcsjDdlService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * ThgdLdcJcsjDdlController
 *
 * @author chenhs
 * @date 2024-09-28
 */
@RestController
@RequestMapping("/thgd/ddl")
public class ThgdLdcJcsjDdlController extends BaseController
{
    @Autowired
    private IThgdLdcJcsjDdlService thgdLdcJcsjDdlService;

    /**
     * 查询ThgdLdcJcsjDdl列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ThgdLdcJcsjDdl thgdLdcJcsjDdl)
    {
        startPage();
        List<ThgdLdcJcsjDdl> list = thgdLdcJcsjDdlService.selectThgdLdcJcsjDdlList(thgdLdcJcsjDdl);
        return getDataTable(list);
    }

    /**
     * 导出ThgdLdcJcsjDdl列表
     */
    @Log(title = "ThgdLdcJcsjDdl", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ThgdLdcJcsjDdl thgdLdcJcsjDdl)
    {
        List<ThgdLdcJcsjDdl> list = thgdLdcJcsjDdlService.selectThgdLdcJcsjDdlList(thgdLdcJcsjDdl);
        ExcelUtil<ThgdLdcJcsjDdl> util = new ExcelUtil<ThgdLdcJcsjDdl>(ThgdLdcJcsjDdl.class);
        util.exportExcel(response, list, "ThgdLdcJcsjDdl数据");
    }

    /**
     * 获取ThgdLdcJcsjDdl详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(thgdLdcJcsjDdlService.selectThgdLdcJcsjDdlById(id));
    }

    /**
     * 新增ThgdLdcJcsjDdl
     */
    @Log(title = "ThgdLdcJcsjDdl", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ThgdLdcJcsjDdl thgdLdcJcsjDdl)
    {
        return toAjax(thgdLdcJcsjDdlService.insertThgdLdcJcsjDdl(thgdLdcJcsjDdl));
    }

    /**
     * 修改ThgdLdcJcsjDdl
     */
    @Log(title = "ThgdLdcJcsjDdl", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ThgdLdcJcsjDdl thgdLdcJcsjDdl)
    {
        return toAjax(thgdLdcJcsjDdlService.updateThgdLdcJcsjDdl(thgdLdcJcsjDdl));
    }

    /**
     * 删除ThgdLdcJcsjDdl
     */
    @Log(title = "ThgdLdcJcsjDdl", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(thgdLdcJcsjDdlService.deleteThgdLdcJcsjDdlByIds(ids));
    }
}
